import React, { Component } from 'react'

import { Table } from 'antd';
const { Column } = Table;

export default class Status extends Component {
  constructor(props) {
    super(props);
    this.state = {
      table: this.filterData(this.props.data)
    }
  }
  componentWillReceiveProps(props) {
    this.setState({table: this.filterData(props.data)});
  }
  render() {
    return (
      <div style={{marginTop: "100px"}}>
        <div>
          <Table dataSource={this.props.data}  pagination={false} size="small">
            <Column title="当前读写头状态" dataIndex="status" key="status" />
            <Column title="当前读取状态" dataIndex="read" key="read" />
            <Column title="写入状态值" dataIndex="insert" key="insert" />
            <Column title="行动" dataIndex="action" key="action" />
            <Column title="改变状态值" dataIndex="turn" key="turn" />
          </Table> 
        </div>
      </div>
    )
  }
  filterData = data => {
    return data.map((ele, index) => {
      return ele.key = index;
    });
  }
}
